package com.cskaoyan.mapper;

import com.cskaoyan.bean.entity.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface GoodsMapper {
    long countByExample(GoodsExample example);

    int deleteByExample(GoodsExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Goods record);

    int insertSelective(Goods record);

    List<Goods> selectByExampleWithBLOBs(GoodsExample example);

    List<Goods> selectByExample(GoodsExample example);

    Goods selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Goods record, @Param("example") GoodsExample example);

    int updateByExampleWithBLOBs(@Param("record") Goods record, @Param("example") GoodsExample example);

    int updateByExample(@Param("record") Goods record, @Param("example") GoodsExample example);

    int updateByPrimaryKeySelective(Goods record);

    int updateByPrimaryKeyWithBLOBs(Goods record);

    int updateByPrimaryKey(Goods record);

    // 根据品牌id获取类目id
    Integer[] getCategoryIdAccordingToBrandId(@Param("brandId") Integer brandId);

    // 根据类目id和品牌id获取商品信息
    Goods getGoodsInfoByBrandIdAndCategoryId(@Param("categoryId") Integer categoryId,@Param("brandId") Integer brandId);

   // 根据商品id获取类目id
   Integer getCategoryIdByGoodsId(@Param("goodsId") Integer goodsId);

    void updateSpecification(GoodsSpecification specification);//自定义商品信息修改语句

    void updateAttribute(GoodsAttribute attribute);//自定义商品信息修改语句

    void updateProduct(Product product);//自定义商品信息修改语句

    void addSingle(GoodsAttribute attribute1);//自定义商品信息修改语句

    void updateGoodsNumberByProductId(@Param("productId") Integer productId, @Param("number") Short number);

    // 根据keyword获取商品信息
    List<Goods> selectGoodsByKeyword(String keyword);

    Goods selectGoodsById(Integer goodsId);


    // 查询热门和新品的商品列表
    List<Goods> selectHotAndNewGoods();


}